import 'package:flutter/material.dart';
import 'package:flutter_login/utils/view_util.dart';

import '../widget/input_widget.dart';
// 登录页
class loginPage extends StatefulWidget {
  const loginPage({super.key});

  @override
  State<loginPage> createState() => _loginPageState();
}

class _loginPageState extends State<loginPage> {

  @override
  Widget build(BuildContext context) {
    // 用于判断是否启用登录按钮 默认是取消的
    bool loginEnable = false;
    // 用户名
    String? userName;
    // 存储密码
    String? userPassword;
    return Scaffold(
      // stack组件实现叠加效果
      body: Stack(
      // stack组件里面的内容写在children中
      children: [
        // 把组件封装起来 返回一个数组用...识别数组
        ..._background(),_content()
      ],
      ),
    );
  }

  _background() {
      return[
        Positioned.fill(
          child: Image.asset(
            "images/login-bg1.jpg",fit: BoxFit.cover,
      ),),

        Positioned.fill(
            child: Container(
      decoration: const BoxDecoration(color: Colors.black54,)
    ))
      ];
  }

    _content(){
    return Positioned.fill(
      left: 25,
      right: 25,
      child: ListView(
        children:[hiSpace(height: 150),
          const Text("账号密码登录",style: TextStyle(fontSize: 26,color:Colors.white ),

          ),
          hiSpace(height: 40),
          InputWidget(
              hint: '请输入用户名',
              obscureText: false,
              keyboardType: TextInputType.text,
              onChanged: (text) {
                print('输入内容发生变化：');
              }
          )]

      ));
    }
}

